<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8"/>
    <title>Title</title>
    <style>
        .one {
            width: 5px;
            margin: 0 auto;
            line-height: 30px;
            font-size: 10px;
            background-color: #ffffff;
            border: none;
        }

        body {
            font-family: SimHei;
        }
    </style>
</head>
<body>
<#escape x as x?html>
    <div>
        <#assign count1=0 />
        <#assign count2=0 />
        <#assign count3=0 />
        <#assign size=13>
        <#if lines?exists>

        <#--计算所有明细合计-----begin----->
            <#assign jfTotal=0>
            <#assign dfTotal=0>
            <#list 0 .. lines?size - 1 as i>
                <#assign line=lines[i]>
                <#if line.creditAmount?exists>
                    <#assign jfTotal +=line.creditAmount >
                </#if>
                <#if line.debitAmount?exists>
                    <#assign dfTotal +=line.debitAmount >
                </#if>
            </#list>

        <#--计算所有明细合计-----=end=----->

            <#assign page=(lines?size/size)?ceiling>
            <#list 1..page as c>
                <div <#if c !=page>style="page-break-after:always;"
                        </#if>>
                    <table width="100%" border="0" cellspacing="0" cellpadding="3" style="font-size:14px;">
                        <tbody>
                        <tr>
                            <td colspan="4" style="width: 100% ;text-align: center">
                                <h2 style="display: inline">${businessEntityName!" "}</h2>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="4" style="width: 100% ;text-align: center">
                                <h2 style="display: inline">记账凭证</h2>
                            </td>
                        </tr>
                        <tr>
                            <td width="25%" style="font-size: 12px;">${voucherPeriod?substring(0,4)!" "}年第${voucherPeriod?substring(5,7)}期</td>
                            <td width="25%" height="30"> </td>
                            <td width="25%" height="30" style="font-size:12px"><#--<#if custom.writeOffAbout!""> 冲销凭证号：${custom.writeOffAbout!" "} <#else> </#if>--> </td>
                            <td width="25%" height="30">  </td>
                        </tr>
                        <tr>
                            <td width="25%" style="font-size: 12px" height="30">过账日期：${voucherDate?date}</td>
                            <td width="25%"><span style="font-size: 12px;">凭证号：${voucherNo!" "}&nbsp;&nbsp;&nbsp;&nbsp;${b!" "}</span></td>
                            <td width="25%" style="font-size: 12px" height="30">(${c}/${page})</td>
                            <td width="25%" style="font-size: 12px" height="30">附件数：${attachmentsNumber!" "}</td>
                        </tr>
                        </tbody>
                    </table>
                    <#if c*size gt lines?size>
                        <#assign end=lines?size-1 />
                    <#else>
                        <#assign end=c*size-1 />
                    </#if>
                    <div width="100%">
                        <table width="100%" border="1" cellspacing="0" cellpadding="0"
                               style="font-size: 12px;text-align: center;">
                            <thead style="background-color: #DBE4F0;">
                            <tr>
                                <td width="20%" height="40">摘要</td>
                                <td width="20%" height="40">科目/订单</td>
                                <td width="10%" height="40">币别</td>
                                <td width="10%" height="40">汇率</td>
                                <td width="10%" height="40">原币金额</td>
                                <td width="15%" height="40">借方</td>
                                <td width="15%" height="40">贷方</td>
                            </tr>
                            </thead>
                            <tbody>
                            <#list (c-1) * size..end as i>
                                <#assign line=lines[i] />
                                <tr>
                                    <td height="60">${line.voucherAbstract!" "}</td>
                                    <td> ${line.subjectCode!" "}-${line.subjectName!" "}(${line.custom.costCenter!" "}${line.custom.profitName!" "})  </td>
                                    <td>${line.currency!" "}</td>
                                    <td>${line.exchangeRate!" "}</td>
                                    <td>${line.originalAmount!" "}</td>
                                    <td>${line.debitAmount!" "}</td>
                                    <td>${line.creditAmount!" "}</td>
                                </tr>
                            </#list>
                            <tr style="background-color: #DBE4F0;">
                                <td colspan="5" height="40" >合计：CNY</td>
                                <td>${jfTotal}</td>
                                <td>${dfTotal}</td>
                            </tr>
                            </tbody>

                        </table>
                    </div>

                </div>
            </#list>
            <div style="">
                <table border="0" cellspacing="0" cellpadding="5" width="100%" style="font-size: 14px;word-break:keep-all;table-layout:fixed;">
                    <tbody>
                    <tr>
                        <td width="16.6%">核准：${operator!" "}</td>
                        <td width="16.6%">经办：${preparedBy!" "}</td>
                        <td width="16.6%">审核：${reviewer!" "}</td>
                        <td width="16.6%">过账：${approvedBy!" "}</td>
                        <td width="16.6%">出纳：${cashier!" "}</td>
                        <td width="16.6%">制单：${preparedBy!" "}</td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </#if>
    </div>
</#escape>
</body>
</html>
